from fastapi import APIRouter, Depends, Request
from module_admin.aspect.interface_auth import CheckUserInterfaceAuth
from module_admin.service.login_service import LoginService
from module_stock.entity.vo.boll_divergence_vo import DivergenceModel
from module_stock.service.kline_boll_service import KlineBollService
from utils.log_util import logger
from utils.response_util import ResponseUtil


bollController = APIRouter(prefix='/stock/boll', dependencies=[Depends(LoginService.get_current_user)])

@bollController.get(
    '/realtime/divergences', response_model=DivergenceModel, dependencies=[Depends(CheckUserInterfaceAuth('stock:basic:all'))]
)
async def get_realtime_divergences(
    request: Request
):
    # 获取实时全量数据
    query_result = await KlineBollService.get_realtime_divergences(request.app.state.redis)
    logger.info('获取成功')

    return ResponseUtil.success(data=query_result)

